# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgname=mandown
pkgver=0.1.3
pkgrel=1
arch=(loong64 x86_64)
license=('Apache')
url="https://gitlab.com/kornelski/mandown"
pkgdesc="Create man pages from markdown markup"
depends=(glibc)
makedepends=(rust cargo)
source=(https://gitlab.com/kornelski/mandown/-/archive/${pkgver}/mandown-${pkgver}.tar.gz)
sha512sums=('c0a51e03293286498923d0d0666950f0da140f1347d9953751102bff5b01b47c64fb3858bd2a311465ca97249a2228c0ec4f408089fe15f3a8429aa04e42d31f')

build() {
  cd "${pkgname}-${pkgver}"
  find -name Cargo.lock -exec rm -f {} \;
  mkdir -p .cargo
  cat > .cargo/config.toml <<EOF
[source.crates-io]
registry = "https://gitee.com/yetist/crates.io-index"
EOF
  cargo build --release --all-features --target-dir=target
}

package() {
  cd "${pkgname}-${pkgver}"
  cargo build --release --locked --all-features --target-dir=target
  install -Dm 755 target/release/${pkgname} -t "${pkgdir}/usr/bin"
}
